package com.ruoqing.test;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ruoqing.core.domain.rquser.UserEntity;
import com.ruoqing.user.AppUserApplication;
import com.ruoqing.user.dao.UserDao;
import com.ruoqing.user.service.api.UserService;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;

import javax.annotation.Resource;
import java.util.List;

/**
	* @author YaoXian
	* @title: testMyBatisPlus
	* @projectName ruoxi-blog
	* @description: 若兮微服务 - 用户服务 - MyBatis-plus测试类
	* @date 2020-11-07 15:36
	*/
@SpringBootTest(classes = AppUserApplication.class)
@RunWith(SpringRunner.class)
public class testMyBatisPlus {

		@Resource
		private UserDao userDao;
		@Resource
		private UserService userService;
		
		@Test
		public void test(){
				QueryWrapper<UserEntity> wrapper = new QueryWrapper<UserEntity>();
				Page<UserEntity> page = new Page<UserEntity>(1,2);
				Page<UserEntity> pages = userDao.selectPage(page, wrapper);
				System.out.println(pages.getTotal() + pages.getPages());
				List<UserEntity> list = pages.getRecords();
				for (UserEntity userEntity : list) {
						System.out.println(userEntity);
				}
		}
}
